package com.todo.strategy.offline.application.backend.controller;

import com.todo.common.common.entity.response.BizPageResponse;
import com.todo.common.common.entity.response.BizResponse;
import com.todo.strategy.offline.application.backend.service.PlatformStrategyBackendService;
import com.todo.strategy.offline.iface.PlatformStrategyBackendIface;
import com.todo.strategy.offline.iface.request.*;
import com.todo.strategy.offline.iface.response.PlatformStrategyDetailResp;
import com.todo.strategy.offline.iface.response.PlatformStrategyRelationItemResp;
import com.todo.strategy.offline.iface.response.PlatformStrategyRelationResp;
import com.todo.strategy.offline.iface.response.QueryPlatformStrategyByConditionResp;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author azhebuxing
 * @date 2024/6/5 13:54
 * @description
 */
@RestController
@RequestMapping("/platform/strategy")
@Tag(name = "平台攻略后台处理类", description = "平台攻略后台处理类")
public class PlatformStrategyBackendController implements PlatformStrategyBackendIface {

    @Resource
    private PlatformStrategyBackendService platformStrategyBackendService;

    @Override
    @Operation(summary = "根据主键id启禁用平台攻略")
    @PostMapping("/enablePlatformStrategyById")
    public BizResponse<Boolean> enablePlatformStrategyById(@RequestBody EnablePlatformStrategyByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.enablePlatformStrategyById(req);
    }

    @Override
    @Operation(summary = "根据主键id查询平台攻略详情")
    @PostMapping("/queryPlatformStrategyDetailById")
    public BizResponse<PlatformStrategyDetailResp> queryPlatformStrategyDetailById(@RequestBody QueryPlatformStrategyDetailByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.queryPlatformStrategyDetailById(req);
    }

    @Override
    @Operation(summary = "多条件查询平台攻略详情")
    @PostMapping("/queryPlatformStrategyByCondition")
    public BizPageResponse<QueryPlatformStrategyByConditionResp> queryPlatformStrategyByCondition(@RequestBody QueryPlatformStrategyByConditionReq req) {
        if (req == null) {
            return BizPageResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizPageResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.queryPlatformStrategyByCondition(req);
    }

    @Override
    @Operation(summary = "新增平台攻略信息")
    @PostMapping("/insertPlatformStrategy")
    public BizResponse<Boolean> insertPlatformStrategy(@RequestBody InsertPlatformStrategyReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.insertPlatformStrategy(req);
    }

    @Override
    @Operation(summary = "更新平台攻略信息")
    @PostMapping("/updatePlatformStrategy")
    public BizResponse<Boolean> updatePlatformStrategy(@RequestBody UpdatePlatformStrategyReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.updatePlatformStrategy(req);
    }

    @Override
    @Operation(summary = "追加平台攻略详情")
    @PostMapping("/appendPlatformStrategyDetail")
    public BizResponse<Boolean> appendPlatformStrategyDetail(@RequestBody AppendPlatformStrategyDetailReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.appendPlatformStrategyDetail(req);
    }

    @Override
    @Operation(summary = "新增平台攻略关联信息")
    @PostMapping("/insertStrategyRelation")
    public BizResponse<Boolean> insertStrategyRelation(@RequestBody InsertStrategyRelationReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.insertStrategyRelation(req);
    }

    @Override
    @Operation(summary = "更新平台攻略关联信息")
    @PostMapping("/updateStrategyRelation")
    public BizResponse<Boolean> updateStrategyRelation(@RequestBody UpdateStrategyRelationReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.updateStrategyRelation(req);
    }

    @Override
    @Operation(summary = "删除平台攻略关联信息")
    @PostMapping("/removeStrategyRelation")
    public BizResponse<Boolean> removeStrategyRelation(@RequestBody RemoveStrategyRelationReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.removeStrategyRelation(req);
    }

    @Override
    @Operation(summary = "根据主键id查询平台攻略关联信息")
    @PostMapping("/queryStrategyRelationById")
    public BizResponse<PlatformStrategyRelationItemResp> queryStrategyRelationById(@RequestBody QueryStrategyRelationByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.queryStrategyRelationById(req);
    }

    @Override
    @Operation(summary = "查询平台攻略关联列表")
    @PostMapping("/queryStrategyRelationList")
    public BizResponse<List<PlatformStrategyRelationResp>> queryStrategyRelationList(@RequestBody QueryStrategyRelationListReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.queryStrategyRelationList(req);
    }

    @Override
    @Operation(summary = "人工检测平台攻略是否通过")
    @PostMapping("/detectionPlatformStrategyById")
    public BizResponse<Boolean> detectionPlatformStrategyById(@RequestBody DetectionPlatformStrategyReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return platformStrategyBackendService.detectionPlatformStrategyById(req);
    }
}
